Quick Action Navigation

您所在的位置:网站首页 create a custom lightning page template component Quick Action Navigation

Quick Action Navigation

2024-07-09 12:50| 来源: 网络整理| 查看: 265

Quick Action Navigation

Use quick actions to invoke a custom Lightning web component on a record page. First, configure a component for quick action and then add it to a record page by adding it to your page layout. A headless quick action doesn't open a modal window, but a screen quick action does.

To create a component for a headless quick action, create an empty template for your component and use the [NavigationMixin.Navigate](pageReference, [replace]) function.

The lwc-recipes repo has a navigateToRecordHeadlessAction component example that uses a headless quick action to navigate to a contact create page.

In this example, clicking the quick action button on a record page opens a modal window that displays the contact create page.

By default, replace is false. When the modal window opens, the URL changes. So you can use the browser's Back button to return to the record page that you previously opened. Similarly, if you use the lookup field to open another modal window, such as to create a new record via the Account Name field, the URL changes again when the New Account modal is displayed.

If replace is true, the pageReference replaces the existing entry in the browser history. When you are on the modal window that's defined by pageReference, clicking the Back button on the browser returns you to the page you visited before the record page that contains the quick action button.

Let's say you have a screen quick action that displays a modal, and that modal uses the [NavigationMixin.Navigate](pageReference, [replace]) function to display another modal with the specific pageReference, such as a record create page.

By default, replace is false and the previous modal isn't closed automatically. In this case, the newer modal overlays and stacks on the previous modal.

For example, if your component navigates to a record create page, the modal that contains your component remains open but inactive while another modal overlays it with the record create page. When you dismiss the new modal with the record create page, the previous modal that contains your component becomes active again.

To automatically close the previous modal when navigating, set replace to true.

This screenQuickAction example shows a screen quick action that contains a button. The button navigates to a contact create page.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3